package com.meixiang.activity.account;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.view.View;

import com.meixiang.R;
import com.meixiang.fragment.coupon.AlreadyFragment;
import com.meixiang.fragment.coupon.OverdueFragment;
import com.meixiang.fragment.coupon.UsableFragment;
import com.meixiang.main.BaseViewPagerActivity;

/**
 * 优惠券
 * author：wangzuzhen on 2016/5/6 0006 10:33.
 */
public class CouponActivity extends BaseViewPagerActivity {
    public static final String TAG = "CouponActivity" ;
    public static final String CODE = "0";
    private String fromCode; //表示从何处跳转过来的
    private String goodsPrice ;
    private String storeId ;
    private String[] normalTitles ; //表示显示过期数据
    private String [] unNormalTitles ; //不显示过期数据
    private Fragment[] normalFragment ;
    private Fragment[] unNormalFragment ;
    public static final String GOODSPRICE ="goodsPrice";
    public static final String STOREID ="storeId";
    public static final String FROMCODE ="fromCode";

    @Override
    protected void setTextNormalColor() {
        super.setTextNormalColor();
        normalTextColor= ContextCompat.getColor(context, R.color.black_8);

    }

    @Override
    protected String[] getTitles() {
        fromCode = getIntent().getStringExtra(FROMCODE);
        goodsPrice = getIntent().getStringExtra(GOODSPRICE);
        storeId = getIntent().getStringExtra(STOREID);
        if("1".equals(fromCode)){
            normalTitles = new String[]{"可用","已用","过期"};
            return normalTitles;
        }else{
            unNormalTitles = new String[]{"可用","不可用"};
            return unNormalTitles;
        }

    }

    @Override
    protected Fragment[] getFragments() {
        Bundle bundle = new Bundle();
        if("1".equals(fromCode)){
            bundle.putString(FROMCODE,fromCode);
            normalFragment = new Fragment[]{new UsableFragment().getIntance(bundle),new AlreadyFragment().getIntance(bundle),new OverdueFragment().getIntance(bundle)};
            return normalFragment ;
        }else{
            bundle.putString(FROMCODE,fromCode);
            bundle.putString(GOODSPRICE,goodsPrice);
            bundle.putString(STOREID,storeId);
            unNormalFragment = new Fragment[]{new UsableFragment().getIntance(bundle),new AlreadyFragment().getIntance(bundle)};
            return unNormalFragment;
        }
    }

    @Override
    protected int ColorStyle() {
        return R.color.member_bg;
    }

    @Override
    protected void setTitle() {
        setTitle("优惠券");
    }

    @Override
    public void onClick(View v) {

    }
}

